/*
 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved.
 */

#include "BurnDlgFaction.h"
#include "WifiBurnDlg.h"
#include "BurnDlg3X.h"
#include "BurnDlgJLink.h"
#include "BurnDlgDfu.h"
#include "BurnDlgMcu.h"
#include "BurnDlgHsan.h"

namespace BurnDlg {

BurnDlgFaction::BurnDlgFaction() {}

BurnDlgFaction::~BurnDlgFaction() {
}

BurnDlg *BurnDlgFaction::GetBurnDlg(ChipType type) const
{
    BurnDlg *burnDlg = nullptr;
    if (Wifi(type)) {
        burnDlg = new WifiBurnDlg(type);
    } else if (type == ChipType::SPARTA || type == ChipType::MELODY || type == ChipType::COMBS25) {
        burnDlg = new BurnDlg3X(type);
    } else if (type == ChipType::JLINKBS25 || type == ChipType::JLINKBS2X || type == ChipType::JLINK2982) {
        burnDlg = new BurnDlgJLink(type);
    } else if (Global::IsUSBType(type)) {
        burnDlg = new BurnDlgDfu(type);
    } else if (type == ChipType::MCU) {
        burnDlg = new BurnDlgMcu(type);
    } else if (Global::IsHsanType(type)) {
        burnDlg = new BurnDlgHsan(type);
    }
    return burnDlg;
}

bool BurnDlgFaction::Wifi(ChipType type) const
{
    if (type == ChipType::WIFI5GNB || type == ChipType::WIFIURANUS ||
        type == ChipType::SWAN || type == ChipType::WIFIDW31 ||
        type == ChipType::BS2X || Global::IsWs63(type) || type == ChipType::WS53 ||
        type == ChipType::WIFI4GCAT1 || type == ChipType::SW39 || type == ChipType::SW21 ||
        type == ChipType::HI3372 || type == ChipType::HI3322 || type == ChipType::COM2982) {
        return true;
    } else {
        return false;
    }
}

}
